//
//  MLZRootTabBarController.m
//  MotherLover
//
//  Created by lanou on 16/1/6.
//  Copyright © 2016年 zj. All rights reserved.
//

#import "MLZRootTabBarController.h"
#import "MLZViewController.h"
#import "MLZCommentsAndShow.h"
#import "MLZMapViewController.h"
#import "MLZLogINViewController.h"
@implementation MLZRootTabBarController
- (void)viewDidLoad{
    [super viewDidLoad];
    

    [self addChildViewController];

}

- (void)addChildViewController{
//动画界面 首页
    MLZViewController *frist = [[MLZViewController alloc]init];
    [self addclass:frist  title:@"动画" name:@"left" selectName:@"left"];
//帖子和展示教程
    MLZCommentsAndShow *show = [[MLZCommentsAndShow alloc]init];
    [self addclass:show title:@"社区" name:@"left" selectName:@"left"];
    //地图搜索附近的母婴界面
    MLZMapViewController *map =[[MLZMapViewController alloc]init];
    [self addclass:map title:@"周边" name:@"left" selectName:@"left"];
        //我的界面
    MLZLogINViewController *my =[[MLZLogINViewController alloc]init];
    [self addclass:my title:@"个人中心" name:@"left" selectName:@"left"];


}



-(void)addclass:(UIViewController*)send  title:(NSString*)title  name:(NSString*)name selectName:(NSString*)selectName{

    //显示到TabBarController上 (需要添加到viewcontrollers得数组中)
    //self.viewControllers = @[oneNav];
    //添加一个按钮标题(tabBarItem)
    send.title= title;
    //设置图片
    //显图片原有的颜色
    //UIImageRenderingModeAlwaysOriginal
    //按原始的版进行绘制(绘制出来是原来的颜色)
    send.tabBarItem.image= [[UIImage imageNamed:name]imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
    //设置选中的图片
    send.tabBarItem.selectedImage= [[UIImage imageNamed:selectName]
                                    imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
    UINavigationController *oneNav = [[UINavigationController alloc]initWithRootViewController:send];
    [self addChildViewController:oneNav];

  




}
-(void)didReceiveMemoryWarning{

    [super didReceiveMemoryWarning];


}
@end
